﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KPIS.GERP.GFMS.MODEL
{
    [Serializable]
    public class M_BGM_ProjectOperationExpense
    {

        public M_BGM_ProjectOperationExpense()
        {

        }

        public Nullable<int> bgm_proj_oper_exp_seq
        {
            get;
            set;
        }

        public Nullable<int> bgm_proj_oper_seq
        {
            get;
            set;
        }

        public string bgm_proj_oper_exp_descr
        {
            get;
            set;
        }

        public Nullable<int> bgm_proj_exp_seq
        {
            get;
            set;
        }

        public Nullable<double> amount
        {
            get;
            set;
        }

        public Nullable<double> used_amount
        {
            get;
            set;
        }

        public Nullable<double> remain_amount
        {
            get;
            set;
        }

        public Nullable<int> exp_rate_count
        {
            get;
            set;
        }

        public Nullable<double> unit_price
        {
            get;
            set;
        }

        public Nullable<int> unit_qty
        {
            get;
            set;
        }

        public M_BGM_ProjectOperation m_bgm_project
        {
            get;
            set;
        }

        public M_BGM_ProjectExpense m_bgm_projectexpense
        {
            get;
            set;
        }

        public string record_status
        {
            get;
            set;
        }

        public Nullable<int> created_by
        {
            get;
            set;
        }

        public Nullable<DateTime> created_when
        {
            get;
            set;
        }

        public Nullable<int> updated_by
        {
            get;
            set;
        }

        public Nullable<DateTime> updated_when
        {
            get;
            set;
        }

        public int? bgm_proj_oper_edit_seq
        {
            get;
            set;
        }

        public int? bgm_proj_oper_edit_exp_seq
        {
            get;
            set;
        }

        public double? old_amount
        {
            get;
            set;
        }

        public double? add_amount
        {
            get;
            set;
        }

        public double? total_amount
        {
            get;
            set;
        }

        public string name
        {
            get
            {
                string exp_name = m_bgm_projectexpense != null && m_bgm_projectexpense.m_bgm_mas_expense != null
                                      ? m_bgm_projectexpense.m_bgm_mas_expense.bgm_exp_name
                                      : "";
                 
                string remain_amount_str = !remain_amount.HasValue ? "" : string.Format("[คงเหลือ {0} บาท]", remain_amount.Value.ToString("#,##0.00"));

                string amount_str = !amount.HasValue ? "" : string.Format("[วงเงิน {0} บาท]", amount.Value.ToString("#,##0.00"));

                return exp_name + remain_amount_str + amount_str;
            }
        }
         
    }
}
